#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 110;

int n;
int q[N];

void solve(){
    scanf("%d", &n);

    for(int i = 1; i <= n; i ++) scanf("%d", &q[i]);

    int k = 1;
    int res = 0;
    for(int i = 1; i <= n; i ++){
        if(q[i] > k){
            res += q[i] - k;
            k = q[i];
        }
        k++;
    }

    printf("%d\n", res);
}

int main(){
    freopen("in.txt","r", stdin);
    freopen("out.txt", "w", stdout);

    int T;
    scanf("%d", &T);
    while(T--){
        solve();
    }

    return 0;
}